﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mime;

namespace NHINDirect
{
    public class MimeEntityCollection : MultipartEntity
    {
        ObjectCollection<MimeEntity> m_entities;
        
        public MimeEntityCollection()
            : base()
        {
        }
        
        public MimeEntityCollection(ContentType contentType)
            : base(contentType)
        {
        }
        
        public MimeEntityCollection(string contentType)
            : base(contentType)
        {
        }                
        
        public MimeEntityCollection(string contentType, IEnumerable<MimeEntity> parts)
            : base(contentType)
        {
            this.Entities.Add(parts);        
        }
        
        public bool HasEntities
        {
            get
            {
                return (this.m_entities != null && this.m_entities.Count > 0);
            }
        }
                
        public ObjectCollection<MimeEntity> Entities
        {
            get
            {
                if (this.m_entities == null)
                {
                    this.m_entities = new ObjectCollection<MimeEntity>();
                }
                
                return this.m_entities;
            }
        }

        public override IEnumerator<MimeEntity> GetEnumerator()
        {
            return this.Entities.GetEnumerator();
        }                 
    }
}
